export default {
  state: {
    // id 唯一标识
    // path 跳转的路径
    // type 0代表是一集标题不可以跳转  1代表可以跳转
    // icon 图标
    // permission 是否有访问权限
    // children 多级菜单栏
    // name_cn i18n中文
    // name_en i18n英文
    // is_alive 是否可以缓存
    menu: [
      {
        "id": 12,
        "path": "/page1",
        "type": 1,
        "icon": "Home",
        "permission": 'v1',
        "children": [],
        "parent_id": 0,
        "name_cn": "WebSocket",
        "name_en": "Test WebSocket",
        "is_alive": 1,
      },
      {
        "id": 2,
        "path": "",
        "type": 0,
        "icon": "system",
        "permission": 'v2',
        "parent_id": 0,
        "name_cn": "系统管理",
        "name_en": "System",
        "is_alive": 0,
        "children": [
          {
            "id": 12,
            "path": "/page2",
            "icon": "role",
            "permission": 'v3',
            "children": [],
            "parent_id": 11,
            "name_cn": "角色管理",
            "name_en": "Role",
            "is_alive": 1,
          },
          {
            "id": 17,
            "path": "/page3",
            "icon": "admin",
            "permission": 'v4',
            "children": [],
            "parent_id": 11,
            "name_cn": "管理员列表",
            "name_en": "Administrator",
            "is_alive": 1,
          }
        ],
      },
      {
        "id": 67,
        "path": "",
        "type": 0,
        "icon": "message",
        "permission": 'v5',
        "parent_id": 0,
        "name_cn": "消息管理",
        "name_en": "Message",
        "is_alive": 0,
        "children": [
          {
            "id": 68,
            "path": "/page4",
            "icon": "template",
            "permission": 'v6',
            "children": [],
            "parent_id": 67,
            "name_cn": "邮件模版",
            "name_en": "Mail template",
            "is_alive": 1,
          },
          {
            "id": 74,
            "path": "/page5",
            "icon": "email",
            "permission": 'v7',
            "children": [],
            "parent_id": 67,
            "name_cn": "邮件记录",
            "name_en": "Mail record",
            "is_alive": 1,
          }
        ],
      },
      {
        "id": 54,
        "path": "",
        "type": 0,
        "icon": "log",
        "permission": 'v8',
        "parent_id": 0,
        "name_cn": "日志管理",
        "name_en": "Log",
        "is_alive": 0,
        "children": [
          {
            "id": 55,
            "path": "/page6",
            "icon": "login-log",
            "permission": 'v9',
            "children": [],
            "parent_id": 54,
            "name_cn": "登录日志",
            "name_en": "Login log",
            "is_alive": 1,
          },
          {
            "id": 57,
            "path": "/page7",
            "icon": "operation-log",
            "permission": 'v10',
            "children": [],
            "parent_id": 54,
            "name_cn": "操作日志",
            "name_en": "Operation log",
            "is_alive": 1,
          },
          {
            "id": 59,
            "path": "/page8",
            "icon": "task-log",
            "permission": 'v11',
            "children": [],
            "parent_id": 54,
            "name_cn": "定时任务日志",
            "name_en": "Timed task log",
            "is_alive": 1,
          },
          {
            "id": 61,
            "path": "/page9",
            "icon": "error-log",
            "permission": 'v12',
            "children": [],
            "parent_id": 54,
            "name_cn": "异常日志",
            "name_en": "Exception log",
            "is_alive": 1,
          }
        ],
      },
      {
        "id": 99,
        "path": '',
        "type": 0,
        "icon": "development",
        "permission": 'v13',
        "parent_id": 0,
        "name_cn": "开发管理",
        "name_en": "Development",
        "is_alive": 0,
        "children": [
          {
            "id": 2,
            "path": "/page10",
            "icon": "menu",
            "permission": 'v14',
            "children": [],
            "parent_id": 1,
            "name_cn": "菜单管理",
            "name_en": "Menu",
            "is_alive": 1,
          },
          {
            "id": 81,
            "path": "/page11",
            "icon": "data-dictionary",
            "permission": 'v15',
            "children": [],
            "parent_id": 1,
            "name_cn": "数据字典",
            "name_en": "Data dictionary",
            "is_alive": 1,
          },
          {
            "id": 46,
            "path": "/page12",
            "icon": "config",
            "permission": 'v16',
            "children": [],
            "parent_id": 1,
            "name_cn": "配置管理",
            "name_en": "Config",
            "is_alive": 1,
          },
          {
            "id": 23,
            "path": "/page13",
            "icon": "clock",
            "permission": 'v17',
            "children": [],
            "parent_id": 1,
            "name_cn": "定时任务",
            "name_en": "Timed task",
            "is_alive": 1,
          },
          {
            "id": 31,
            "path": "/page14",
            "icon": "folder",
            "permission": 'v18',
            "children": [],
            "parent_id": 1,
            "name_cn": "文件上传",
            "name_en": "File upload",
            "is_alive": 1,
          },
          {
            "id": 91,
            "path": "/page15",
            "icon": "region",
            "permission": 'v19',
            "children": [],
            "parent_id": 1,
            "name_cn": "区域管理",
            "name_en": "Region",
            "is_alive": 1,
          },
          {
            "id": 36,
            "path": "/page16",
            "icon": "backup",
            "permission": 'v20',
            "children": [],
            "parent_id": 1,
            "name_cn": "备份管理",
            "name_en": "Backup",
            "is_alive": 1,
          },
          {
            "id": 78,
            "path": "/page17",
            "icon": "generator",
            "permission": 'v21',
            "children": [],
            "parent_id": 1,
            "name_cn": "代码生成器",
            "name_en": "Code generator",
            "is_alive": 1,
          },
          {
            "id": 44,
            "path": "http://139.196.182.46:8806/slipper/static/apidoc/index.html",
            "icon": "request",
            "permission": 'v22',
            "children": [],
            "parent_id": 1,
            "name_cn": "接口文档",
            "name_en": "Interface document",
            "is_alive": 1,
          },
          {
            "id": 45,
            "path": "http://139.196.182.46:8806/slipper/druid/index.html",
            "icon": "druid",
            "permission": 'v23',
            "children": [],
            "parent_id": 1,
            "name_cn": "Druid监控",
            "name_en": "Druid monitoring",
            "is_alive": 1,
          }
        ],

      }
    ],
    // 是否折叠侧边栏
    isOpen: false,
    activeTab: '',
    tabList: [],
    powerList: ['v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7', 'v8', 'v9', 'v10', '11', 'v12', 'v13', 'v14', 'v15', 'v16', 'v17', 'v18', 'v19', 'v20', '21', 'v22', 'v23', 'v24', 'v25', 'v26', 'v27', 'v28', 'v29', 'v30']
  },
  getters: {
    GetNumber: (state) => {
      return state.number
    },
    GETACTIVETAB: (state) => {
      return state.activeTab
    },
    GETTABLIST: (state) => {
      return state.tabList
    },
    GETPOWERLIST: (state) => {
      return state.powerList
    }
  },
  mutations: {
    CHANGE_ISOPEN (state, value) {
      state.isOpen = value
    },
    ADD_TAB (state, newTab) {
      if (!newTab.path || state.tabList.some(item => item.path == newTab.path)) return
      state.tabList.push(newTab)
    },
    DELBYPATH (state, path) {
      let indexArr = []
      state.tabList.forEach((item, index) => {
        if (item.path == path) {
          indexArr.push(index)
        }
      })
      if (indexArr.length) {
        indexArr.forEach((item) => {
          state.tabList.splice(item, 1)
        })
      }
    },
    EDITACTIVETAG (state, path) {
      state.activeTab = path
    }
  },
  actions: {

  }
}
